<?php 

	class imgDownload{
		
		private $filename;
		private $path = './upload/';
		
		public function __construct(){
			$this->filename = $this->path . $_GET["name"];
			//echo '<pre>';
			$info = getimagesize($this->filename);
			//print_r($info);
			header("Content-Type:". $info["mime"]);
			header("Content-Disposition:attachment;filename=".$_GET["name"]);
			header("Content-Length:".filesize($this->filename));
		}
		
		public function download(){
			
			readfile($this->filename);
		}
		
	}
	
	$Download = new imgDownload();
	
	$Download->download();
	
	